﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ENG.TeachersDiary
{
  public partial class FrmProgress : Form
  {
    public FrmProgress()
    {
      InitializeComponent();
    }

    private void FrmProgress_FormClosing(object sender, FormClosingEventArgs e)
    {
      if (e.CloseReason == CloseReason.UserClosing)
        e.Cancel = true;
    }

    private void tmrTimer_Tick(object sender, EventArgs e)
    {
      Application.DoEvents();
    }

    private void FrmProgress_VisibleChanged(object sender, EventArgs e)
    {
      if (this.Visible == true)
        Application.UseWaitCursor = true;
      else
        Application.UseWaitCursor = false;
      tmrTimer.Enabled = this.Visible;

    }

    private void FrmProgress_Load(object sender, EventArgs e)
    {

    }

    internal void SetInfoText(string infoText)
    {
      if (this.InvokeRequired)
        this.Invoke(new Action<string>(this.SetInfoText), new object [] {infoText});
      else
      {
        if (string.IsNullOrEmpty(infoText))
          infoText = Properties.Resources.Working;

        lblInfo.Text = infoText + "...";

        Application.DoEvents();
      }
    }
  }
}
